/*************************************
* @update: 2021-04-21   LiLinBin  [创建文件,加入echarts,axios等全局库]
* @update: 2021-07-09   LiLinBin  [添加findComp到全局,用于注入脚本]
* @update: 2021-12-27   LiLinBin  [添加日期格式化工具]
* 
* @description: 全局变量,全局库等等
****************************************/


import { uuid, joinAttr, newDateFormat, resDataFilter, getFontRate, pxToEm, setLineHeight } from 'tools/utils/2_dataTool'
import { findComp, showPageByPageId, consoleDesName } from 'tools/utils/3_pageTool'

import axios from 'tools/utils/1_axios'
import * as echarts from 'echarts'
import eventBus from 'tools/eventBus/eventBus'
import _ from 'lodash'


//添加日期格式化工具
newDateFormat()



//全局常用库
window.axios = axios            //数据请求axios库
window.echarts = echarts        //echarts库
window.eventBus = eventBus      //事件中央总线
window._ = _                    //全局lodash库
window.findComp = findComp      //查找页面中指定的组件实例对象 (用于注入脚本时)



//手动挂载的全局其它库
window.Lib = {}



//手动挂载的全局函数,变量
window.T = {
    uuid,               //生成uuid
    joinAttr,           //拼接属性 (用于changeMixin改变属性配置项)
    showPageByPageId,   //获取页面

    resDataFilter,      //对接口数据进行过滤
    getFontRate,    //获取组件$el字体相对html字体的倍数
    pxToEm,         //将px单位转换成em
    setLineHeight,      //设置行高将px单位转换成em

    consoleDesName,     //函数,打印当前组件信息,使用: consoleDesName.call(this)

    isVTools: !!process.env.isVTools
}




Object.freeze(window.Lib)
Object.freeze(window.T)



export default window